/* Copyright (c) 2009 Mark L. Howison
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  (1) Redistributions of source code must retain the above copyright notice,
 *      this list of conditions and the following disclaimer.
 *  (2) Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *  (3) The name of the copyright holder may not be used to endorse or promote
 *      products derived from this software without specific prior written
 *      permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

package edu.berkeley.edrl.wiikinemathics;

import org.jdesktop.application.Action;
import org.jdesktop.application.FrameView;

/**
 * The application's main frame.
 */
public class WiiKinemathicsView extends FrameView {

    public WiiKinemathicsView(WiiKinemathicsApp app) {
        super(app);

        initComponents();

        mainPanel.add(app.controlPanel);
        mainPanel.setPreferredSize(app.controlPanel.getSize());
    }

    @Action
    public void showAboutBox() {
        WiiKinemathicsApp.getApplication().aboutBox.openAboutBox();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        windowsMenu = new javax.swing.JMenu();
        motionWindowMenuItem = new javax.swing.JMenuItem();
        cameraWindowMenutItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(edu.berkeley.edrl.wiikinemathics.WiiKinemathicsApp.class).getContext().getResourceMap(WiiKinemathicsView.class);
        mainPanel.setBackground(resourceMap.getColor("mainPanel.background")); // NOI18N
        mainPanel.setName("mainPanel"); // NOI18N

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(edu.berkeley.edrl.wiikinemathics.WiiKinemathicsApp.class).getContext().getActionMap(WiiKinemathicsView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        windowsMenu.setText(resourceMap.getString("windowsMenu.text")); // NOI18N
        windowsMenu.setName("windowsMenu"); // NOI18N

        motionWindowMenuItem.setText(resourceMap.getString("motionWindowMenuItem.text")); // NOI18N
        motionWindowMenuItem.setName("motionWindowMenuItem"); // NOI18N
        motionWindowMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                motionWindowMenuItemActionPerformed(evt);
            }
        });
        windowsMenu.add(motionWindowMenuItem);

        cameraWindowMenutItem.setText(resourceMap.getString("cameraWindowMenutItem.text")); // NOI18N
        cameraWindowMenutItem.setName("cameraWindowMenutItem"); // NOI18N
        cameraWindowMenutItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cameraWindowMenutItemActionPerformed(evt);
            }
        });
        windowsMenu.add(cameraWindowMenutItem);

        menuBar.add(windowsMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        setComponent(mainPanel);
        setMenuBar(menuBar);
    }// </editor-fold>//GEN-END:initComponents

    private void motionWindowMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_motionWindowMenuItemActionPerformed
        WiiKinemathicsApp.getApplication().showMotionWindow();
    }//GEN-LAST:event_motionWindowMenuItemActionPerformed

    private void cameraWindowMenutItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cameraWindowMenutItemActionPerformed
        WiiKinemathicsApp.getApplication().showCameraWindow();
    }//GEN-LAST:event_cameraWindowMenutItemActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem cameraWindowMenutItem;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem motionWindowMenuItem;
    private javax.swing.JMenu windowsMenu;
    // End of variables declaration//GEN-END:variables

}
